<?php
namespace App\Models;

use Illuminate\Database\Eloquent\Model;

/**旅游线路模型*/
class Tour extends Model  {

	/**
	 * The database table used by the model.
	 *
	 * @var string
	 */
	protected $table = 'tour';
	protected $primaryKey  ='tour_id';

    /**
     * Indicates if the model should be timestamped.
     *
     * @var bool
     */
    public $timestamps = false;

    /**
     * Indicates if the primary key should be incrementing.
     *
     * @var bool
     */
    //protected $incrementing =false;

    /**
     * The storage format of the model's date columns.
     *
     * @var string
     */
    //protected $dateFormat = 'U';

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    //protected $fillable = ['name'];

    /**
     * The attributes that aren't mass assignable.
     *
     * @var array
     */
    //protected $guarded = ['price'];

    //use SoftDeletes;

    /**
     * The attributes that should be mutated to dates.
     *
     * @var array
     */
    //protected $dates = ['deleted_at'];

    /**
     * The attributes excluded from the model's JSON form.
     *
     * @var array
     */
    protected $hidden = ['if_show','add_user_id','add_time','last_update'];

	/**
	 * 模型关系
	 *
	 * $this->belongsTo('App\Models\A','this.','A.');
	 * $this->hasOne('App\Models\A','A.','this.');
	 * $this->hasMany('App\Models\A','A.','this.');
	 * $this->belongsToMany('App\Models\A','A_this','this.','A.');
	 * $this->hasManyThrough('App\Models\A', 'App\Models\middle','middle.','A.','this.');
	 *
	 */

	/**
	 * The tour belongs to store.
	 */
	public function store()
	{
		return $this->belongsTo('App\Models\Store','store_id','store_id');
	}

	/**
	 * The tour belongs to tourCategory.
	 */
	public function tourCategory(){
		return $this->belongsTo('App\Models\TourCategory','cate_id','cate_id');
	}

	/**
	 * The tour has one tourExtra
	 */
	public function tourExtra(){
		return $this->hasOne('App\Models\TourExtra','tour_id','tour_id');
	}

	/**
	 * The tour has many tourImage
	 */
	public function tourImage(){
		return $this->hasMany('App\Models\TourImage','tour_id','tour_id');
	}

	/**
	 * The tour has many tourSchedule
	 */
	public function tourSchedule(){
		return $this->hasMany('App\Models\TourSchedule','tour_id','tour_id');
	}

	/**
	 * The tour has one tourSettings
	 */
	public function tourSettings(){
		return $this->HasOne('App\Models\TourSettings','tour_id','tour_id');
	}

	/**
	 * The tour has one tourSettings
	 */
	public function tourStatistics(){
		return $this->HasOne('App\Models\TourStatistics','tour_id','tour_id');
	}

	/**
	 * The tour has many tourTuan
	 */
	public function tourTuan(){
		return $this->hasMany('App\Models\TourTuan','tour_id','tour_id');
	}

	public function tourComments(){
		return $this->hasMany('App\Models\TourComment','tour_id','tour_id');
	}

	public function tourOrder(){
		return $this->hasMany('\App\Models\TourOrder','tour_id','tour_id');
	}

}
